let person = {
    name: 'mike',
    age: 18
}
function getValues(person: any, keys: string[]) {
    return keys.map(key => person[key])
}
console.log(getValues(person, ['name', 'age'])) // [ 'mike', 18 ]
console.log(getValues(person, ['gender'])) // [undefined]

function myGetValues<T, K extends keyof T>(person: T, keys: K[]): T[K][] {
    return keys.map(key => person[key])
}
interface MyPerson {
    name: string,
    age: number
}
myGetValues(person, ['name'])
// myGetValues(person, ['gender']) // 不能将类型“"gender"”分配给类型“"name" | "age"”